package com.czb.seckill.controller;

import com.czb.seckill.rabbitmq.MQSender;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author: 陈正彬
 */
@Controller
public class RabbitMQHandler {

    @Resource
    private MQSender mqSender;

    //方法 调用消息生产者，发送消息
    @RequestMapping("/mq")
    @ResponseBody
    public void mq(){
        mqSender.send("hello,czb");
    }

    //方法 调用消息生产者，发送消息
    @RequestMapping("/mq/fanout")
    @ResponseBody
    public void fanout(){
        mqSender.sendFanout("hello,fanout");
    }

    //方法 调用消息生产者，发送消息
    @RequestMapping("/mq/direct1")
    @ResponseBody
    public void direct1(){
        mqSender.sendDirect1("hello,direct1");
    }

    @RequestMapping("/mq/direct2")
    @ResponseBody
    public void direct2(){
        mqSender.sendDirect2("hello,direct2");
    }

    @RequestMapping("/mq/topic01")
    @ResponseBody
    public void topic01(){
        mqSender.sendTopic01("hello,topic01");
    }

    @RequestMapping("/mq/topic02")
    @ResponseBody
    public void topic02(){
        mqSender.sendTopic02("hello,topic02");
    }
}
